<?php
function getAllTag(){
    $db_r = new db_query('SELECT DISTINCT rev_tag AS tag FROM reviews');
    $tag_array1 = $db_r->resultArray();
    unset($db_r);
    $db_n = new db_query('SELECT DISTINCT new_tags AS tag FROM news');
    $tag_array2 = $db_n->resultArray();
    $tag_array = array_merge($tag_array1,$tag_array2);
    unset($db_n);
    $tags = array();
    foreach($tag_array as $tag_str){
        $tag = trim($tag_str['tag']);
        $tags[] = $tag;
    }
    $tmp1 = explode(',',implode(',',$tags));
    $tmp_arr = array();
    foreach($tmp1 as $tmp){
        $tmp = mb_strtolower($tmp, 'UTF-8');
        $tmp_arr[] = trim($tmp);
    }
    return array_unique($tmp_arr);
}

function getTagHot($tag){
    $db = new db_count('SELECT count(*) AS count 
                        FROM reviews,news 
                        WHERE reviews.rev_tag LIKE "%'.$tag.'%" 
                              OR news.new_tags LIKE "%'.$tag.'%"');
    return $db->total;
}
?>